//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _MODEL_RANDOMCOLOR_H
#define _MODEL_RANDOMCOLOR_H
//
#include <global.h>
#include "multitypedata.h"
#include "multitypedatacontainer.h"
//
namespace model
{
class RandomColor:public MultiTypeDataContainer
{
//data classes
public:
   static int const type_constant=1;
   class Data:public MultiTypeData
   {
      Q_DISABLE_COPY(Data)
      DISABLE_ADDRESSOF(Data)
   protected:
      Data(int p_type);
   public:
      virtual osg::Vec4 calculate()const=0;
   };
   class Constant:public Data
   {
      Q_DISABLE_COPY(Constant)
      DISABLE_ADDRESSOF(Constant)
   public:
      Constant(const osg::Vec4 &p_value=osg::Vec4());
      const osg::Vec4 &get_value()const;
      void set_value(const osg::Vec4 &p_value);
      osg::Vec4 calculate()const;
   public:
      MultiTypeData *clone()const;
      void store(QDataStream &p_stream)const;
      void restore(QDataStream &p_stream);
   private:
      osg::Vec4 value;
   };
//construction
public:
   RandomColor();
   RandomColor(Data *p_data);
//data
public:
   const Data &data()const;
   const Constant &as_constant()const;
   Constant &as_constant();
//type
protected:
   MultiTypeData *create_data(int p_type)const;
};
}
//
#endif
